<?php $this->pageTitle = $data->title . ' - ' . Yii::app()->name ?>
<ul class="breadcrumb">
  <li><a href="/"><i class="fa fa-home"></i> 首页</a></li>
  <li><a href="<?= Yii::app()->createUrl('lesson/view', array('id' => $data->lesson->lesson_id)) ?>"><i
          class="fa fa-book"></i> <?= CHtml::encode($data->lesson->name) ?></a></li>
  <li><a href=""><i class="fa fa-file-o"></i> 文章详情</a></li>
</ul>
<div class="panel panel-default">
  <div class="panel-heading"><i class="fa fa-file-o"></i> 文章详情</div>
  <div class="panel-body">
    <article>
      <h2 class="title"><?= CHtml::encode($data->title) ?></h2>
      <aside>
        <i class="fa fa-list-alt"></i>
        <a href="<?= Yii::app()->createUrl('lesson/view', array('id' => $data->lesson->lesson_id)) ?>"
           title="<?= CHtml::encode($data->lesson->name) ?>">
          <?= CHtml::encode($data->lesson->name) ?>
        </a>
        <i class="fa fa-calendar"></i> <?= date('Y-m-d H:i:s', $data->created_at) ?>
        <i class="fa fa-fire"></i> <?= $data->hits ?>
        <div class="content">
          <?= CHtml::decode($data->content) ?>
        </div>
        <?php if (!Yii::app()->user->isGuest): ?>
          <?php if (!$token): ?>
            <button class="btn btn-success" data-article="<?= $data->article_id ?>" data-action="learn">学习</button>
          <?php else: ?>
            <span class="text-success">这篇文章你已经学习过啦!</span>
          <?php endif ?>
        <?php endif ?>
      </aside>
    </article>
  </div>
  <div class="panel-footer">
    上一篇：
    <?php if (empty($prev)): ?>
      没有了
    <?php else: ?>
      <a href="<?= Yii::app()->createUrl('article/view', array('id' => $prev->article_id)) ?>"
         title="<?= CHtml::encode($prev->title) ?>"><?= CHtml::encode($prev->title) ?></a>
    <?php endif ?>
    下一篇：
    <?php if (empty($next)): ?>
      没有了
    <?php else: ?>
      <a href="<?= Yii::app()->createUrl('article/view', array('id' => $next->article_id)) ?>"
         title="<?= CHtml::encode($next->title) ?>"><?= CHtml::encode($next->title) ?></a>
    <?php endif ?>
  </div>
</div>